2.0 How to Use the AGB Infrared Adapter

> 2.1 Using the AGB Infrared Adapter

> If you are planning to use the communication capabilities of the AGB Infrared Adapter in your Game Boy Advance software, please inform us at least six months in advance and explain how you want to use the device.

> 2.2 How to Use the AGB Infrared Adapter

> In order to use the AGB Infrared Adapter, you need to make use of the AGB's general-purpose communication mode. Specify each port as shown in the table below:

> Port | When in Use (Standby Mode) | When Not in Use (Shutdown Mode)
> SO | Low Output | Low Output
> SI | Input | Input
> SD | Hi Output | Low Output
> SC | Low Output | Input

> These processes are included in the following functions:

> Release from shutdown mode | irEnable | At the start of communication
> Shutdown mode | irDisable | At program startup/end of communications

> Note that it is not necessary to switch to shutdown mode in the middle of the sequence when the communications are performed continuously.

> SO is the signal output port. In Standby mode, an optical pulse is output when a Hi pulse is output to SO.

> SI is the signal-input port. Usually SI is 1, but in Standby mode, 0 is input for several microseconds when there is an optical input. In Shutdown mode, this signal does not change.

> When the data is actually being exchanged, it is essential that all processing is conducted in accordance with the communications protocol. If you are going to use the Nintendo standard protocol, please read the "AGB Infrared Communication Library Manual" carefully before you create your program. Also, please make a note of the common points of caution explained in Section 2.3, below.

> If you are going to use something other than the Nintendo standard protocol, be sure to note the cautions regarding protocol creation to ensure the reliability of your protocol described in Section 2.4 of this manual. Also, please make a note of the common points of caution explained in Section 2.3.

> 2.3 Common Points of Caution

> - Switch to the Shutdown mode when communications are not in progress and please be sure to maintain that mode, when there is a chance that the user will remove the AGB Infrared Adapter.
> - Determine whether the AGB Infrared Adapter is connected to the AGB. The irDetection function can detect whether the AGB Infrared Adapter is connected to the AGB.

> > When this function detects the AGB Infrared Adapter (i.e., when the AGB Infrared Adapter is connected to the AGB's External Extension Connector) it returns the value IR_SUCCESS. Otherwise, the function returns IR_FAILURE (i.e., when nothing is connected or the Game Link or another device is connected to the External Extension Connector).

> > If the SIO was in Standby mode before the function was called, then the SIO remains in Standby mode after the function terminates. Otherwise, the SIO goes into Shutdown mode after the function terminates.

> > NOTE: Do not use a custom procedure for detecting the AGB Infrared Adapter. This may result in the faulty operation when other peripherals are connected to the AGB. Use the supplied irDetection function.

> 2.4 Cautions when Creating a Protocol

> If your objective is to communicate with other devices and you plan to use something other than the Nintendo standard protocol (e.g. IrDA etc.), please take note of the following cautions. In addition, please review Section 3. "Electrical Specifications" and confirm that operation is assured regardless of product variations.

> Even though you have confirmed operation on your AGB unit, note that the variations between the lots and the differences among the parts makers means that there is a chance it will not operate in the commercial market. In addition to testing it on your AGB unit, be sure to check it against the specifications.

> Please contact us at support@noa.com or 425-861-2715 if you plan to conduct communications with a CGB (CGB Game Pak).

> Cautions

> Communication Speed
> The maximum data transfer rate of the AGB Infrared Adapter is 115.5 kbps. (IRDA protocol)

> Mode Switching
> The state is not stable for 2 µs after it switches from Shutdown mode to Standby mode. Do not perform communications during that time.

> Emitted Optical Pulses
> The pulse width output to SO should be no longer than 10 µs. Do not keep SO to Hi. The optical pulse width takes on the same size as the SO pulse width, the optical pulse width may not be the same when the SO pulse width exceeds 10 µs.

> For low-speed communications and other cases where you want to emit a pulse that is longer than 10 µs, output a series of 10 µs pulses as shown in the figure below. Note that even in this case, it is important to make sure that the total pulse width is no longer than 150 µs.

> Received Optical Pulses

> Hi is input to SI when there is no signal.

> When an optical signal is received, the positive edge of the optical pulse is sensed and a Lo pulse is output. Be aware that a Lo pulse can be output for reasons other than an optical signal sent by the communications partner. For example, a Lo pulse can also be output due to a change in ambient lighting or an optical noise from a light fixture. For this reason, you should prepare a checksum or another method to guarantee the reliability of the received data.

> The width of the received optical pulse that is input to SI is approximately 1 µs - 5 µs regardless of the width of the optical pulse. Please be sure to detect only the SI negative edge and do not use the pulse width as data. Also, if the received light has a long pulse width, the SI could drop to Lo multiple times during the pulse. Detect only the first SI negative edge and dispose of any subsequent data prescribed by the protocol during the pulse. (Do not count the number of times the SI falls.)

> Transmitting and Receiving

> Data cannot be transmitted and received at the same time. This is because the transmitting unit would take its own emitted light to receive light signals. Also, after a unit has emitted light, it does not enter a stable receiving state for 500 µs. Thus, in creating a protocol, please wait at least 500 µs after a series of pulses has been received before starting transmissions.